HAL LPTIM migration: List of applicable concepts ¶
This section provides information about the HAL LPTIM applicable architecture concepts.
Concepts for LPTIM ¶
|
Concept |
Description |
|---|---|
|
The initialization and the configuration are split into 2 level functions:
|
|
|
Removal and conversion of init structure to configuration structure |
The initialization structure has been removed and converted into
|
|
The handle structure has been renamed to
|
|
|
The structure
|
|
|
|
|
|
New APIs are available to set and get LPTIM features. |
|
|
The
|
|
|
Two functions to set and get user data are available:
|
|
|
Individual callback registration APIs replace global register and unregister functions |
The callback registration is handled by specific functions for each LPTIM event. These functions are used to register callback functions for different LPTIM events. |
|
Global
|
|
|
HAL LPTIM APIs now rely on LL APIs rather than performing direct register access. |
|
|
Define statements and enumerations redirected to LL equivalents |
HAL LPTIM define statements and enumerations are based on LL define statements. |
|
All hardware macros have been removed from the HAL LPTIM driver, and equivalent services are ensured through the LL APIs. |
|
|
The LPTIM now is managed by two state machine :
|
|
|
The HAL LPTIM functions were updated to return:
|
|
|
The HAL error handling mechanisms have been redesigned to improve the detection, reporting, and handling of errors. |
|
|
New APIs for filtering optional asynchronous process interrupts |
New APIs are provided in the LPTIM to filter and manage asynchronous process interrupts :
|
|
All TypeDef parts of the HAL LPTIM driver have been removed and replaced by
|
|
|
Const keywords have been added to non-modifiable pointers to ensure that either the pointer itself or the data it points to cannot be modified. This enhances code safety and readability, prevents unintended modifications, and renders code more robust and maintainable. |
|
|
The parameters and state are checked using
|
|
|
Merge HAL extension files with common ones and remove the EX prefix from APIs. |
Only one HAL LPTIM header file remains and all macros, define statements, and functions from
|
|
Add HAL PPP Services for Drivers with Handle to Retrieve Corresponding Peripheral Clock Frequency. |
HAL LPTIM provides new API to retrieve clock frequency
|
|
Replace Finite Parameter Defines (Including PPP Instances) with Enum Types at HAL Levels. |
Finite parameters (including LPTIM instances) have been converted into enumerated types (enums) at HAL level. This improves code readability, maintainability, and type safety. |
|
Change Channel Argument to 0-Based Enumeration in Timer Channels |
The HAL channels are now represented as an incremental 0-based enumeration. |
|
Add HAL_PPP Prefix to All HAL Peripheral APIs (Defines, Macros, Types, and Functions). |
All HAL LPTIM functions start with
|
Other HAL LPTIM changes ¶
|
Concept |
Consideration |
|---|---|
|
LPTIM clock source: |
In HAL1: The initialization structure,
Other fields in the configuration structure, like
In HAL2: The clock configuration has been made more flexible. The following options can now be selected:
The configuration is done with a single enumeration (
Note
The APIs
|
|
Input Capture mode: |
In HAL1: To start or stop Input Capture in Polling, Interrupt (IT), or DMA mode, specific APIs are provided for each mode:
These APIs internally handle starting and stopping the LPTIM counter, so no separate call to start or stop the timer is needed In HAL2: Starting and stopping Input Capture is done using dedicated channel APIs for each mode(Polling, IT and DMA):
In contrast to HAL1, these APIs do not start or stop the LPTIM timer itself. The user must explicitly start and stop the timer by calling:
|
|
LPTIM Counter output modes: |
In HAL1: Different APIs are provided for each output type (PWM, One-Pulse, SetOnce) and for Timeout functionality. The output waveform and timeout behavior depend on which API is used to start the counter.
In HAL2: The separate APIs for each output type (
Instead, the desired mode is first selected using
|